﻿using System.Collections.Generic;
using SimpleWorkflow.Data;
using SimpleWorkflow.Patterns;

namespace SimpleWorkflow.Steps
{
    public sealed class LinearSteps<T> : SimpleStep<T>, ILinearSteps where T : ISharedFlowContext
    {
        internal List<ISimpleStep> Steps { get; set; }

        [ComplexStepExtension]
        public string ReferenceKey { get; set; }

        public LinearSteps()
        {
            Steps = new List<ISimpleStep>();
        }

        public override void Run()
        {
            foreach (var step in Steps)
                RunProxy(step);
        }

        public void AddStep(ISimpleStep step)
        {
            Steps.Add(step);
        }
    }
}
